package com.hisan.freeride.home.adapter;

import com.facebook.drawee.view.SimpleDraweeView;
import com.github.library.BaseQuickAdapter;
import com.github.library.BaseViewHolder;

import com.hisan.freeride.R;
import com.hisan.freeride.common.utils.CollectionUtils;
import com.hisan.freeride.home.model.WelfareMessage;


import java.util.List;

/**
 * 公益广场列表适配器
 * Created by yu on 2017/1/17.
 */

public class Welfare_Message_ListAdapter extends BaseQuickAdapter<WelfareMessage,BaseViewHolder> {

    public Welfare_Message_ListAdapter(List<WelfareMessage> data) {
        super(R.layout.welfaare_message_item,data);
    }


    @Override
    protected void convert(BaseViewHolder holder, WelfareMessage item) {
        if (!CollectionUtils.isNullOrEmpty(item.getUser())){
            if (!CollectionUtils.isNullOrEmpty(item.getUser().getAvatar())){
                SimpleDraweeView simpleDraweeView= holder.getView(R.id.logo);
                simpleDraweeView.setImageURI(item.getUser().getAvatar());
            }
            holder.setText(R.id.name, item.getUser().getNickname());
        }
        holder.setText(R.id.content, item.getContent());
        holder.setText(R.id.data, item.getCreate_time());
    }
}
